import Vue from 'vue';
import Router from 'vue-router';
import index from '@/pages/index';
import home from '@/pages/home';
import dash from '../pages/html/dash';
import {routerConfig, htmlRoutersConfig} from './routerConfig';
import loadComponent from './lazyLoad'



let routers = loadComponent(routerConfig);
let htmlRouters = loadComponent(htmlRoutersConfig);
let local=sessionStorage.getItem('allRouter');
if(local){
    routers=loadComponent(JSON.parse(local))
}
console.log('allRouters', routers);
Vue.use(Router);
export default new Router({
    routes: [
        { path: '/',  name: 'dash', redirect: { name: 'home' }, component: dash ,children: htmlRouters },
        { path: '/index', name: 'index', redirect: { name: 'container' }, component: index, children: routers },
    ],
});
